home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form form1
- Caption = "Moving button example, by Alesh Mustar"
- ClientHeight = 3870
- ClientLeft = 4470
- ClientTop = 3075
- ClientWidth = 6135
- Height = 4275
- Left = 4410
- LinkTopic = "Form1"
- ScaleHeight = 3870
- ScaleWidth = 6135
- Top = 2730
- Width = 6255
- Begin VB.CommandButton Command1
- Caption = "Click me, to find out the meaning of life..."
- Height = 765
- Left = 930
- TabIndex = 0
- Top = 600
- Width = 4365
- End
- Begin VB.Label Label1
- Caption = "Greetings to the members of VBBN && #visualbasic channel on Efnet!!!"
- Height = 255
- Left = 540
- TabIndex = 1
- Top = 1620
- Width = 5085
- End
- Attribute VB_Name = "form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- 'check if the command button is 600 pixels from the top of the form
- If Command1.Top = 600 Then
- 'set the i value, from 600 to the form's height - 2 height's of the button
- 'so that the button doesn't go to much down, step Y Axis, per pixel
- For i = 600 To form1.Height - 2 * Command1.Height Step Screen.TwipsPerPixelY
- Command1.Top = i 'move the command button to position which = i
- Next i 'repeat till i = the value assigned
- Else 'if the button is not upstairs, it can only be downstairs
- 'set i value to form's height - 2 times height of the button to 600
- 'step Y Axis, per pixel but minus way so the button will move back up
- For i = form1.Height - 2 * Command1.Height To 600 Step -Screen.TwipsPerPixelY
- Command1.Top = i 'move the command button to position which = i
- Next i 'repeat till i = the value assigned
-
- End If
- End Sub
-